package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.entity.TbPaper;
import com.qf.service.TbPaperService;
import com.qf.mapper.TbPaperMapper;
import com.qf.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class TbPaperServiceImpl extends ServiceImpl<TbPaperMapper, TbPaper> implements TbPaperService{

    private final TbPaperMapper tbPaperMapper;

    public TbPaperServiceImpl(TbPaperMapper tbPaperMapper) {
        this.tbPaperMapper = tbPaperMapper;
    }

    @Override
    public Result replyDetailByStudentId(Long student) {
        LambdaQueryWrapper<TbPaper> lqw =new LambdaQueryWrapper<>();
        lqw.eq(TbPaper::getStudentid,student);
        TbPaper tbPaper = tbPaperMapper.selectOne(lqw);
        return Result.success("查询成功",tbPaper);
    }

    @Override
    public Result commit(Long studentId) {
        TbPaper massageByStudentId = tbPaperMapper.getMassageByStudentId(studentId);
        return Result.success("查询成功",massageByStudentId);
    }
}




